package com.woniu.service.impl;

import com.woniu.dto.CaseDto;
import com.woniu.entity.CaseInfo;
import com.woniu.mapper.CaseInfoMapper;
import com.woniu.service.CaseService;
import com.woniu.utils.ResponseEnum;
import com.woniu.utils.ResponseUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.sql.Date;

/**
 * @Author: zcy
 * @Create: 2025/10/30 19:05
 */
@Service
public class CaseServiceImpl implements CaseService {
    @Resource
    private CaseInfoMapper caseInfoMapper;
    @Override
    public ResponseUtil add(CaseDto caseInfo) {

        CaseInfo caseInfo1 = new CaseInfo();
        caseInfo1.setCiDescription(caseInfo.getDescription());
        caseInfo1.setCiCaseId(caseInfo.getPatientId());
        caseInfo1.setCiWorkerId(caseInfo.getSid());
        caseInfo1.setCiType("1");
        caseInfo1.setCiDate(new Date(System.currentTimeMillis()));
        int insert = caseInfoMapper.insert(caseInfo1);
        return insert > 0 ? ResponseUtil.get(ResponseEnum.OK) : ResponseUtil.get(ResponseEnum.FAIL);
    }
}
